﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Jewelery
{
    public partial class GeneralForm : Form
    {
        public GeneralForm()
        {
            InitializeComponent();
        }

        
     
        private void button3_Click(object sender, EventArgs e)
        {
            int sum = 0;
            int[] jewelery = new int[3];

            try
            {
                this.Text = "Calculate complete";
                if ((Convert.ToInt32(DKol.Text) + Convert.ToInt32(PKol.Text)) > 200)
                {
                    this.Text = "Неправильно введено количество ( < 200 )";
                }
                else
                {
                    jewelery[0] = Convert.ToInt32(DKol.Text);
                    jewelery[1] = Convert.ToInt32(DPrice.Text);

                    jewelery[2] = jewelery[0] * jewelery[1];
                    DSum.Text = Convert.ToString(jewelery[2]);

                    jewelery[0] = Convert.ToInt32(PKol.Text);
                    jewelery[1] = Convert.ToInt32(PPrice.Text);

                    jewelery[2] = jewelery[0] * jewelery[1];
                    PSum.Text = Convert.ToString(jewelery[2]);


                    sum = sum + Convert.ToInt32(PSum.Text) + Convert.ToInt32(DSum.Text);
                    OSum.Text = Convert.ToString(sum);
                }
            }
            catch
            {
                this.Text = "Неправильно введены данные";
            }
        }

    }
}
